// 属性名的索引类型
type MyObj = {
  [property: string]: string
}

const obj: MyObj = {
  name: 'foo',
  age: '25',
  gender: 'male',
}

// 对象的key 除了 string 还有 number and symbol
type T1 = {
  [property: number]: string
}

type T2 = {
  [property: symbol]: string
}

type MyArr = {
  [n: number]: number
}

const arr: MyArr = [1, 2, 3]

const arr2: MyArr = {
  0: 1,
  1: 2,
  2: 3,
}

type MyType = {
  // [x: number]: boolean,
  [x: string]: string
}

type MyType2 = {
  // foo: boolean,
  [x: string]: string
}

const arr3: MyArr = [1, 2, 3]
// arr3.length
